//
//  BottomViewOfCell.swift
//  WeiBlog
//
//  Created by xiang on 15/10/20.
//  Copyright © 2015年 xiang. All rights reserved.
//

import UIKit

class BottomViewOfCell: UIView {

    init(){
        super.init(frame: CGRectZero)
//        backgroundColor = UIColor.lightGrayColor()
        setUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
// MARK: - 懒加载
    
    //转发按钮
    private lazy var retweetBtn:UIButton = UIButton(title: " 转发", fontSize:9, color: UIColor.darkGrayColor(), bgImageName: "qq", imageName: "timeline_icon_retweet", actionName: "click", target: self)
    //评论按钮
    private lazy var commentBtn:UIButton = UIButton(title: " 评论", fontSize:9, color: UIColor.darkGrayColor(), bgImageName: "qq", imageName: "timeline_icon_comment", actionName: "click", target: self)
    //点赞按钮
    private lazy var likeBtn:UIButton = UIButton(title: " 赞", fontSize:9, color: UIColor.darkGrayColor(), bgImageName: "qq", imageName: "timeline_icon_unlike", actionName: "click", target: self)
    
    /// 分割线
    private lazy var seperateLine1:UIView = UIView()
    private lazy var seperateLine2:UIView = UIView()
    private lazy var seperateLine3:UIView = UIView()
    private lazy var seperateLine4:UIView = UIView()
    
    
    @objc private func click(){print("ss")}
}


// MARK: - 设置界面
extension BottomViewOfCell
{
    private func setUI(){
        
        //添加控件
        addSubview(retweetBtn)
        addSubview(commentBtn)
        addSubview(likeBtn)
        addSubview(seperateLine1)
        addSubview(seperateLine2)
        addSubview(seperateLine3)
        addSubview(seperateLine4)
        seperateLine1.backgroundColor = UIColor.lightGrayColor()
        seperateLine2.backgroundColor = UIColor.lightGrayColor()
        seperateLine3.backgroundColor = UIColor.lightGrayColor()
        seperateLine4.backgroundColor = UIColor.lightGrayColor()
        //自动布局
        retweetBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self.snp_left)
            make.centerY.equalTo(self)
        }
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetBtn.snp_right)
            make.centerY.equalTo(self)
            make.width.equalTo(retweetBtn)
        }
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentBtn.snp_right)
            make.width.equalTo(retweetBtn)
            make.centerY.equalTo(self)
            make.right.equalTo(self.snp_right)
        }
        seperateLine1.snp_makeConstraints { (make) -> Void in
            make.width.equalTo(1/UIScreen.mainScreen().scale)
            make.height.equalTo(self).multipliedBy(0.4)
            make.centerY.equalTo(self)
            make.left.equalTo(retweetBtn.snp_right)
        }
        seperateLine2.snp_makeConstraints { (make) -> Void in
            make.width.equalTo(1/UIScreen.mainScreen().scale)
            make.height.equalTo(self).multipliedBy(0.4)
            make.centerY.equalTo(self)
            make.left.equalTo(commentBtn.snp_right)
        }
        seperateLine3.snp_makeConstraints { (make) -> Void in
            make.height.equalTo(1/UIScreen.mainScreen().scale)
            make.width.equalTo(self)
            make.left.equalTo(self)
            make.top.equalTo(self)
        }
        seperateLine4.snp_makeConstraints { (make) -> Void in
            make.height.equalTo(1/UIScreen.mainScreen().scale)
            make.width.equalTo(self)
            make.left.equalTo(self)
            make.bottom.equalTo(self.snp_bottom)
        }
    }
}